namespace Spectrum {

      using namespace msl;

      template< typename T, int Rank, bool Sparsity >
      class DistributedStructuredMatrix;

      template< typename T, int Rank, bool Sparsity >
      class RowProxy  {

      protected:

            // pointer to the distributed sparse matrix
            const DistributedStructuredMatrix< T, Rank, Sparsity >& m;
            // row index of the element to retrieve
            int rowIndex;

      
      public:

            /* Default constructor. Constructs a RowProxy object by means
               of the given reference to the distributed sparse matrix
               object and the row index of the element to access.

               - DistributedSparseMatrix<T, S, D>& dsm: A reference to the
                   distributed sparse matrix object which stores the element
                   to access.
               - int rowIndex: The row index of the element to access.
            */
            RowProxy(const DistributedStructuredMatrix< T, Rank, Sparsity >& m): m(m) {
            }

            /* Sets the stored row index to the given row index.
            */
            void setRowIndex(int index) {
                  rowIndex = index;
            }

            /* Overwrites the index operator []. Accesses the element of
               the distributed sparse matrix by calling the getElement
               method.
            */
            T operator[](int columnIndex) const {
                  return m.getElement(rowIndex, columnIndex);
            }

      };
      
      
}
